local mod_name = ...

-- 短网址编码顺序表,非顺序的 字母 + 数字
local base_table = {'e','Q','W','3','s','5','R','J','a','g','M','T','7','n','O','X','8','f','2','o','z','w','G','K','x','D','Z','F','b','u','N','L','S','l','Y','V','I','t','4','q','6','A','y','1','i','B','C','c','P','0','U','r','k','j','m','p','9','h','v','d','E','H'}

-- Base string of Base table
local base_str = table.concat( base_table, "")

-- Redis database config
local redis = {}
redis['host'] = '127.0.0.1'
redis['port'] = 6379
redis['password'] = 'password'

-- 初始化短网址长度及代码
-- 不同位数对应可用数量 编码表长度^n
-- 1  ->  62
-- 2  ->  3844
-- 3  ->  238328
-- 4  ->  14776336
-- 5  ->  916132832
-- 6  ->  56800235584
-- 7  ->  3521614606208
-- 8  ->  218340105584896
-- 9  ->  13537086546263552
-- 10 ->  839299365868340224
-- 11 ->  52036560683837093888
-- 12 ->  3226266762397899821056
-- 13 ->  200028539268669788905472
-- 14 ->  12401769434657526912139264
-- 15 ->  768909704948766668552634368
-- 16 ->  47672401706823533450263330816


--* 注意：已经在使用中的话，就不能再修改 start_url、prefix、suffix 参数了
local start_url = {'e','T','2','W','0'}
-- 短网址前缀
local prefix = '12'

-- 短网址后缀
local suffix = '34'

-- 短网址域名
-- 可以为空仅返回短网址
local domain = 'http://192.168.1.30/'

-- URL 的黑白名单
-- 如:  www.example.com
-- example.com 与 www.example.com 是两个不同的域名
-- 白名单优先于黑名单
-- local white_host = {'baidu.com','www.baidu.com','map.baidu.com'}
local white_host = {}
local black_host = {}

-- 错误返回值
local err_msg = {}
err_msg[34] = 'URL 已经存在'
err_msg[41] = 'URL 无效，请以 http|https|ftp 开头'
err_msg[42] = 'URL 不在允许的名单中'
err_msg[51] = 'Redis 服务错误'
err_msg[52] = 'Redis 获取数据错误'
err_msg[53] = '短网址库数量不足'

local M = {}
M['base_table'] = base_table
M['base_str'] = base_str
M['start_url'] = start_url
M['prefix'] = prefix
M['suffix'] = suffix
M['white_host'] = white_host
M['black_host'] = black_host
M['err_msg'] = err_msg
M['redis'] = redis
M['domain'] = domain


return M
